package com.hulk.dryad.manage.framework.operlog;

import com.hulk.dryad.manage.provider.service.SysOperLogService;
import lombok.RequiredArgsConstructor;
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * Swagger 页面静态文件配置
 *
 * @author hulk
 */

@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@RequiredArgsConstructor
public class OperLogjAutoConfiguration  {

	private final ApplicationEventPublisher publisher;
	private final Ip2regionSearcher searcher;
	private final SysOperLogService sysOperLogService;
	@Bean
	@ConditionalOnMissingBean
	public OperLogAspect requestLogAspect(){
		return  new OperLogAspect(publisher);

	}

	@Bean
	@ConditionalOnMissingBean
	public OperLogListener operLogListener(){
		return  new OperLogListener(searcher,sysOperLogService);

	}

}
